// pages/person/index.js
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    nickName : "",
    avatarUrl : "",
    gender : "",
    province : "",
    city : "",
    country : ""
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
 
    //获取storage中存放的用户信息
 
    var userInfo = wx.getStorageSync('userInfo');
    var that = this;
    if(userInfo.gender ==0){
      userInfo.gender = '未定义'
    }else if(userInfo.gender ==1){
      userInfo.gender = '男'
    }else {
      userInfo.gender = '女'
    }
 
      //给data中数据赋值
 
    that.setData({   
      nickName : userInfo.nickName,
      avatarUrl:userInfo.avatarUrl,
      gender: userInfo.gender,
      province: userInfo.province,
      city: userInfo.city,
      country: userInfo.country
    }) 
  }
})